package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.FetalEntity
import com.sm.healthy.data.bean.OxygenEntity
import com.sm.healthy.data.bean.TemperatureEntity

@Dao
interface TemperatureDao {

    @Insert
    suspend fun insert(temperatureEntity: TemperatureEntity)

    @Update
    suspend fun update(temperatureEntity: TemperatureEntity)

    @Delete
    suspend fun delete(temperatureEntity: TemperatureEntity)

    @Query("DELETE FROM temperature")
    suspend fun deleteAll()

    @Query("SELECT * FROM temperature")
    fun getTemperature(): LiveData<List<TemperatureEntity>>

    @Query("SELECT * FROM temperature WHERE  timeLong >:before and timeLong <:after")
    fun getTemperatureByTime(before: Long, after: Long): LiveData<List<TemperatureEntity>>
}